﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Net.NetworkInformation;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;

namespace Tool.AutoSend
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            webBrowser1.IsWebBrowserContextMenuEnabled = false;
        }
        
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            string path = e.Url.AbsolutePath;
            if (path.StartsWith("/admin/login", true, CultureInfo.CurrentCulture))
            {
                this.WindowState = FormWindowState.Normal;
                this.Size = new Size(500, 400);
                this.Text = "欢迎登录";
            }
            else
            {
                this.WindowState = FormWindowState.Maximized;
                this.Text = "欢迎使用自动更新程序。";
            }

            MessageBox.Show(e.Url.ToString());
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Ping ping = new Ping();
            PingReply reply = ping.Send("");
            if (reply.Status.Equals(IPStatus.Success))
            {
                //可以访问
            }
        }
    }
}
